var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        paginationClickable: true
    });
var lis = document.querySelectorAll(".swiper-pagination-bullet");
var fm = document.querySelector("#fm");

//首页加载
function login(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/5.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html = template('test', obj);
	    document.getElementById('matter').innerHTML = html;
	});
	$("#ye").html($("<p><span class='yy xz'>1</span><span class='yy'>2</span><span class='yy'>3</span><span>...</span><span class='yy'>后一页></span><span class='yy'>末页>></span></p>"))
}login();
//导航切换
$("#fa").on("click",function(){
	$("#d").css("left","9%");
	$(document).scrollTop(480);
	login();
	$("#nn").html($("<p id='nn'><span class='jing dao'>精选游记</span><span class='dao'><span class='zi'>出发时间</span><span class='xia'><img src='images/xia_02.png'/></span></span><span class='dao'><span class='zi'>国外旅游</span><span class='xia'><img src='images/xia_02.png'/></span></span><span class='dao'><span class='zi'>国内旅游</span><span class='xia'><img src='images/xia_02.png'/></span></span></p>"));
	$("#ye").html($("<p><span class='yy xz'>1</span><span class='yy'>2</span><span class='yy'>3</span><span>...</span><span class='yy'>后一页></span><span class='yy'>末页>></span></p>"));
});

//鼠标移入移出
var dao = document.querySelectorAll(".dao");
var timers = document.querySelectorAll(".timers");
for(var i = 1; i < dao.length ; i++){
	dao[i].index = i;
	dao[i].onmouseover = function(){
		var j = this.index - 1;
		timers[j].style.opacity = "1";
	}
	dao[i].onmouseout = function(){
		var j = this.index - 1;
		timers[j].style.opacity = "0";
	}
}
	
for(var n = 0 ; n < timers.length ; n++){
	timers[n].onmouseover = function(){
		this.style.opacity = "1";
	}
	timers[n].onmouseout = function(){
		this.style.opacity = "0";
	}
}
	//创建国外旅游
var arra = ['日本','泰国','美国','韩国','法国','马来西亚','意大利','英国','德国','新加坡','澳大利亚','柬埔寨','瑞士','越南','西班牙','印度','尼西亚','奥地利','土耳其','新西兰','菲律宾','斯里兰卡','阿联酋','俄罗斯','加拿大','马尔代夫','捷克','荷兰','希腊','尼泊尔','比利时','印度','摩纳哥','匈牙利','新目的地','芬兰','瑞典','挪威','丹麦','埃及','葡萄牙','缅甸','卡塔尔','南非','墨西哥','老挝','冰岛','毛里求斯','列支敦士登','以色列','伊朗','卢森堡','斯洛伐克','肯尼亚','爱尔兰','帕劳','波兰','约旦','摩洛哥','斐济','巴西','朝鲜','克罗地亚','塞舌尔','爱沙尼亚','秘鲁','波多黎各','突尼斯','斯洛文尼亚','古巴','马耳他','阿根廷','智利','不丹','塞尔维亚','波黑共和国','巴基斯坦','马其顿共和国','立陶宛','黑山共和国','塞浦路斯','保加利亚','马达加斯加','南极','哈萨克斯坦','坦桑尼亚','文莱','哥斯达黎加','孟加拉国','蒙古国','委内瑞拉','罗马尼亚','白俄罗斯','布隆迪','巴林','阿曼','吉布提','沙特阿拉伯'];
for(var c = 0 ; c < arra.length ; c++){
	var lii = $("<li>" + arra[c] + "</li>");
	$("#jia").append(lii)
}




//获取数据
function login2(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/3-1.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html2 = template('test2', obj);
	    document.getElementById('matter').innerHTML = html2;
	});
};
$("#lv").on("click",function(){
	$("#d").css("left","43%");
	$(document).scrollTop(480);
	$("#nn").css("width","750px");
	$("#nn").html($("<span class='jing dao2' id='ya'>国外-亚洲</span><span class='dao2' id='o'>国外-欧洲</span><span class='dao2' id='ta'>国外-其他</span><span class='dao2' id='tai'>国内-港澳台</span><span class='dao2' id='da'>国内-大陆</span>"));
	login2();
	$("#ye").html("");
});

$("#xie").on("click",function(){
	$("#d").css("left","75.5%");
	$(document).scrollTop(480);
});

//导航高亮
$("#nn").on("click",".dao2",function(){
	$(this).addClass("jing").siblings().removeClass("jing"); 
});
$("#nn").on("click","#ya",function(){
	login2();
})

function login3(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/3-2.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html2 = template('test2', obj);
	    document.getElementById('matter').innerHTML = html2;
	});
};
function login4(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/3-3.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html2 = template('test2', obj);
	    document.getElementById('matter').innerHTML = html2;
	});
};
function login5(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/3-4.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html2 = template('test2', obj);
	    document.getElementById('matter').innerHTML = html2;
	});
};
function login6(){
	$.get("http://localhost/Chanyouji/dist/src/app/scripts/3-5.php",function(data){
    // 将json格式的字符串(json串)转换成json对象
	    var obj = JSON.parse(data);
	    var html2 = template('test2', obj);
	    document.getElementById('matter').innerHTML = html2;
	});
};
$("#nn").on("click","#o",function(){
	login3();
});
$("#nn").on("click","#ta",function(){
	login4();
});
$("#nn").on("click","#tai",function(){
	login5();
});
$("#nn").on("click","#da",function(){
	login6();
});

//登录框
$("#enter").bind("click",function(){
	$("#enters").css("display","block");
});
$("#x").bind("click",function(){
	$("#enters").hide();
});
//$("#enters").bind("click",function(){
//	if ($("#enters").css("display") == "block") {
//		$("#enters").hide();
//	}
//});

//手机应用
$("#tel").on("click",function(){
	$("#baoqilai2").show();
	$("#baoqilai").hide();
});
$("h1").on("click",function(){
	$("#baoqilai").show();
	$("#baoqilai2").hide();
});
$("#qing").on("click",function(){
	$("#baoqilai2").show();
	$("#baoqilai").hide();
	$("#box-c").css("left","-200%");
	$("#d2").css("left","75.5%");
});


$("#chan").on("click",function(){
	$("#box-c").css("left","0");
	$("#d2").css("left","9%");
});
$("#bir").on("click",function(){
	$("#box-c").css("left","-100%");
	$("#d2").css("left","43%");
});
$("#qiu").on("click",function(){
	$("#box-c").css("left","-200%");
	$("#d2").css("left","75.5%");
});
var bol = true;
$("#tc1").on("click",function(){
	if(bol){
		$("#ma1").css("width","130px");
		$(".ew").eq(0).css("right","-130px")
		bol = false;
	}else{
		$("#ma1").css("width","0px");
		$(".ew").eq(0).css("right","-15px")
		bol = true;
	}
	
});
var bol2 = true;
$("#tc2").on("click",function(){
	if(bol2){
		$("#ma2").css("width","130px");
		$(".ew").eq(1).css("right","-130px")
		bol2 = false;
	}else{
		$("#ma2").css("width","0px");
		$(".ew").eq(1).css("right","-15px")
		bol2 = true;
	}
	
});
var bol3 = true;
$("#tc3").on("click",function(){
	if(bol3){
		$("#ma3").css("width","130px");
		$(".ew").eq(2).css("right","-142px")
		bol3 = false;
	}else{
		$("#ma3").css("width","0px");
		$(".ew").eq(2).css("right","-27px")
		bol3 = true;
	}
	
});

